import time
from selenium import webdriver
from selenium.webdriver.common.by import By


class register:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.get('file:///C:/Users/1/Desktop/qd/html/%E6%B3%A8%E5%86%8C%E5%AE%9E%E4%BE%8B.html')

    def putin(self):
        top = self.driver.find_elements(By.TAG_NAME, 'input')
        for i in range(4):
            top[i].send_keys('1')
        top[i].send_keys("@qq.com")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]').click()
        time.sleep(1)

    def frame1putin(self):
        self.driver.switch_to.frame('idframe1')
        frame1 = self.driver.find_elements(By.TAG_NAME, 'input')
        for i in range(4):
            frame1[i].send_keys('1')
        frame1[i].send_keys("@qq.com")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, 'button[type="submitA"]').click()
        time.sleep(1)
        self.driver.switch_to.default_content()

    def frame2putin(self):
        self.driver.switch_to.frame('myframe2')
        frame2 = self.driver.find_elements(By.TAG_NAME, 'input')
        for i in range(4):
            frame2[i].send_keys('1')
        frame2[i].send_keys("@qq.com")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, 'button[type="submit"]').click()
        time.sleep(1)
        self.driver.switch_to.default_content()



